<template>
	<view class="Class_record">
		<card :query="query"></card>
		<scroll-view scroll-y="true" class="scroll-view-Y">
			<view class="comlum_box">
				<view v-for="(item,index) in query.log" :key="index" class="Item">
					<view class="top">
						<view class="name">
							{{item.that_str}}
						</view>
						<view class="time">
							{{item.class_time}}
						</view>
					</view>
					
					<view class="foot">
						<view class="left">
							<image :src="item.coach_avatar" mode="aspectFill" class="img"></image>
							<view class="size">
								{{item.coach_nickname}}
							</view>
						</view>
						<view class="right">
							<view class="btn1" @click="feedback">
								教练反馈
							</view>
							<view :class="!item.is_evaluate?'btn2':'btn3'" @click="evaluate(item, index)">
								{{!item.is_evaluate?'评价':'已评价'}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import card from './components/class_card.vue'
	import{
		mycourseInfoHistory
	} from '@/api/user.js'
	export default {
		components: {
			card
		},
		data() {
			return {
				my_course_id:'',
				query: {},
				historyList: []
			}
		},
		onLoad(e){
			this.my_course_id = e.my_course_id
			this.getmycourseInfo()
		},
		onShow() {
			let that = this
			uni.$on('SHOPID', function(data) {
				that.getmycourseInfo()
			})
		},
		methods: {
			getmycourseInfo(){
				mycourseInfoHistory({
					my_course_id:this.my_course_id
				}).then(({data:res})=>{
					if (res.code == 1) {
						this.query = res.data
					}
				})
			},
			feedback() {
				this.$refs.uToast.show({
					title: '功能正在研发中，敬请期待',
					type: 'default',
					icon:false
				})
			},
			evaluate(item, index){
				if(!item.is_evaluate){
					uni.navigateTo({
						url:'evaluation?log_id='+item.log_id
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #e9e9e9;
	}

	.Class_record {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 24rpx;

		.scroll-view-Y {
			width: 100%;
			height: 75vh;

			.comlum_box {
				width: 100%;
				display: flex;
				flex-direction: column;
				align-items: center;
				padding-top: 20rpx;

				.Item {
					width: 702rpx;
					background: #ffffff;
					border-radius: 16rpx;
					padding: 24rpx 32rpx;
					display: flex;
					flex-direction: column;
					margin-bottom: 18rpx;
					.top{
						display: flex;
						flex-direction: row;
						align-items: center;
						width: 100%;
						padding-bottom: 22rpx;
						border-bottom: 1rpx solid #e9e9e9;
					}
					.name {
						font-size: 28rpx;
						font-family: PingFang SC, PingFang SC-Bold;
						font-weight: 700;
						text-align: left;
						color: #333333;
						flex: 1;
					}

					.time {
						font-size: 28rpx;
						font-family: PingFang SC, PingFang SC-Regular;
						font-weight: 400;
						text-align: left;
						color: #666666;
					}

					.foot {
						display: flex;
						flex-direction: row;
						align-items: center;
						width: 100%;
						padding: 26rpx 0;

						.left {
							display: flex;
							flex-direction: row;
							align-items: center;
							flex: 1;

							.img {
								width: 80rpx;
								height: 80rpx;
								border-radius: 50%;
								margin-right: 8rpx;
							}

							.size {
								font-size: 28rpx;
								font-family: PingFang SC, PingFang SC-Medium;
								font-weight: 500;
								color: #000000;
							}
						}

						.right {
							display: flex;
							flex-direction: row;
							align-items: center;

							.btn1 {
								transform: rotateZ(360deg);
								width: 152rpx;
								height: 64rpx;
								border: 1rpx solid #73F0EA;
								border-radius: 16rpx;
								font-size: 28rpx;
								font-family: PingFang SC, PingFang SC-Bold;
								font-weight: 700;
								color: #73F0EA;
								display: flex;
								align-items: center;
								justify-content: center;
							}

							.btn2 {
								transform: rotateZ(360deg);
								width: 152rpx;
								height: 64rpx;
								background: #73F0EA;
								border: 1rpx solid #73F0EA;
								border-radius: 16rpx;
								font-size: 28rpx;
								font-family: PingFang SC, PingFang SC-Bold;
								font-weight: 700;
								color: #ffffff;
								display: flex;
								align-items: center;
								justify-content: center;
								margin-left: 8rpx;
							}
							
							.btn3{
								width: 152rpx;
								height: 64rpx;
								background: #e9e9e9;
								border-radius: 16rpx;
								font-size: 28rpx;
								font-family: PingFang SC, PingFang SC-Bold;
								font-weight: 700;
								text-align: center;
								color: #b6b6b6;
								display: flex;
								align-items: center;
								justify-content: center;
								margin-left: 8rpx;
							}
						}
					}
				}
			}
		}
	}
</style>